import apmon.*;
import java.util.*;

public class MonaTest {

	public static final int NumberOfEntries = 1000;
	public static final String ConfigFileName = "config/mona.cfg";
	
	public static void main(String args[]) {
		ApMon apm = null;

		try {
			apm = new ApMon(ConfigFileName);
		} catch (Exception e) {
			System.err.println("Eroare creare instanta ApMon: " + e);
			e.printStackTrace();
		}
		
		Random r = new Random();

		for (int i = 0; i < NumberOfEntries; i++) {
			double value = r.nextDouble() * 1000;
			
			try {
				apm.sendParameter("SASN-Lab7-Test", "Test-1", "random_param", value);
				System.err.println("i=" + i + ": Sent value " + value + " at time " + System.currentTimeMillis());
				Thread.sleep(2000);
			} catch (Exception e) {
				System.err.println("Eroare: " + e);
				e.printStackTrace();
			}
		}
	}

}
